#!/usr/bin/env python
# -*-coding:utf-8-*-
# File    : liyuqi.py

import xlrd

data = xlrd.open_workbook('students.xlsx')

ws = data.sheets()[0]
# print(ws.ncols)
# print(ws.nrows)

students = []
for r in range(1, ws.nrows):
    student_info = {}
    for c in range(ws.ncols):
        # 获取每一列的第一行数据做为字典的key
        tiltle = ws.cell_value(0, c)
        # 获取每一列的当前行数据做为字典的value
        value = ws.cell_value(r, c)
        # 组装字典
        student_info[ws.cell_value(0, c)] = value
    # 添加到列表中
    students.append(student_info)
print(students)
